Sort Array By Date

Using Javascript, I wanted to sort and display the most future dates in a list / table (using CouchDB , so don't forget the info is in the doc object)

	data = [
	{id: 1, doc: {dateOf: "2030-10-1"}}
	{id: 2, doc: {dateOf: "2023-12-5"}}
	{id: 3, doc: {dateOf: "2023-2-25"}}
	]
	data.sort((prev, curr) =>{
		return new Date(prev.doc.dateOf) - new Date(curr.doc.dateOf)
	}).reverse()

Credits

#javascript